﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Assignment3
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length!=0)
            {
                List<string> input = ReadFile.Read(args[0]);
                KnowledgeBase kb = new KnowledgeBase(input);
                Console.WriteLine("\nInput File: {0}", args[0]);

                List<string> newfacts = new List<string>();

                int reasoningAttempt = 1;
                while (true)
                {
                    kb.ReasoningNewFacts(ref newfacts);

                    if (newfacts.Count == 0)
                        break;
                    Console.WriteLine("\nNew fact after reasoning {0}:", reasoningAttempt);
                    foreach (string newfact in newfacts)
                    {
                        Console.WriteLine(newfact);
                    }
                    kb.AddNewFacts(newfacts);
                    reasoningAttempt++;
                }

                Console.WriteLine("\nEnter to finish");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Please put input file in command line argument");
                Console.ReadLine();
            }
        }
    }
}
